package algorithm.nlp.corenlp;

import algorithm.config.HumanLanguage;
import edu.stanford.nlp.pipeline.Annotation;
import edu.stanford.nlp.pipeline.StanfordCoreNLP;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Created by common on 2017/4/8.
 */
public class TextAnnotator {

    static final Logger logger = LoggerFactory.getLogger(TextAnnotator.class);

    //private Annotation document;
    public StanfordCoreNLP pipeline;


    public TextAnnotator(HumanLanguage language){
        //this.document = new Annotation(text);
        this.pipeline = new CoreNLPFactory().getPipeline(language);
    }


    public Annotation getAnnotatedText(String text){
        Annotation document = new Annotation(text);

        this.pipeline.annotate( document );

        pipeline.prettyPrint(document, System.out);

        return document;
    }



}
